<!DOCTYPE html>
<html>

	<head>
		<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1">
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="../../css/iuapmobile.um.css">
		<link rel="stylesheet" href="../../css/font-icons.css">
		<link rel="stylesheet" href="../../css/iscroll.css" />
		<style>
			.select_dummy {
				border: none;
				padding-left: 10px;
				color: #555;
				font-size: 14px;
				text-align: right;
				margin-right: 20px;
				width: 100%;
			}
			
			.select_dummy:disabled {
				background: #fff;
			}
		</style>
		<script src="../../js/summer.js"></script>
		<script src="../../js/jquery.min.js"></script>
		<script src="../../js/Frameworks/iuapmobile.frameworks.ui.js"></script>
		<script src="../../js/iscroll.js"></script>
		<script src="../../js/angular.min.js"></script>
	</head>

	<body class="f14" ng-app="myApp" ng-controller="myCtrl">
		<!--um-win-->
		<div class="um-page" id="repaircheckInstalled">
			<div class="um-header">
				<a href="#" class="um-back back"> 返回 </a>
				<h3>维修验收详情</h3>
			</div>
			<div class="um-content">
				<ul class="um-list">
					<li>
						<div class="um-list-item">
							<div class="um-list-item-inner">
								<div class="um-list-item-left pl5">
									设备编号
								</div>
								<div class="um-list-item-right">
									<span class="form-control tr">{{data.bsbbh}}</span>
								</div>
							</div>
						</div>
					</li>
					<li>
						<div class="um-list-item">
							<div class="um-list-item-inner">
								<div class="um-list-item-left pl5">
									资产编号
								</div>
								<div class="um-list-item-right">
									<span class="form-control tr">{{data.bzcbh}}</span>
								</div>
							</div>
						</div>
					</li>
					<li>
						<div class="um-list-item">
							<div class="um-list-item-inner">
								<div class="um-list-item-left pl5">
									点位号
								</div>
								<div class="um-list-item-right">
									<span class="form-control tr">{{data.bdwh}}</span>
								</div>
							</div>
						</div>
					</li>
					<li>
						<div class="um-list-item">
							<div class="um-list-item-inner">
								<div class="um-list-item-left pl5">
									故障描述
								</div>
								<div class="um-list-item-right">
									<span class="form-control tr">{{data.bgzms}}</span>
								</div>
							</div>
						</div>
					</li>
					<li>
						<div class="um-list-item">
							<div class="um-list-item-inner">
								<div class="um-list-item-left pl5">
									故障判定类型
								</div>
								<div class="um-list-item-right">
									<span class="form-control tr">{{data.js_gzpdlx}}</span>
								</div>
							</div>
						</div>
					</li>
					<li>
						<div class="um-list-item">
							<div class="um-list-item-inner">
								<div class="um-list-item-left pl5">
									故障判定描述
								</div>
								<div class="um-list-item-right">
									<span class="form-control tr">{{data.js_gzpdms}}</span>
								</div>
							</div>
						</div>
					</li>
					<li>
						<div class="um-list-item">
							<div class="um-list-item-inner">
								<div class="um-list-item-left pl5">
									完工照片
								</div>
								<div class="um-list-item-right">
									<img id="wg_wgzp" ng-model="data.wg_wgzp" ng-src="{{data.wg_wgzp}}" class="h50 p5 lookimg" />
								</div>
							</div>
						</div>
					</li>
					<li>
						<div class="um-list-item">
							<div class="um-list-item-inner">
								<div class="um-list-item-left pl5">
									更换件照片
								</div>
								<div class="um-list-item-right">
									<img id="wg_ghjzp" ng-model="data.wg_ghjzp" ng-src="{{data.wg_ghjzp}}" class="h50 p5 lookimg" />
								</div>
							</div>
						</div>
					</li>
					<li>
						<div class="um-list-item">
							<div class="um-list-item-inner">
								<div class="um-list-item-left pl5">
									本人出境照
								</div>
								<div class="um-list-item-right">
									<img id="wg_brcjz" ng-model="data.wg_brcjz" ng-src="{{data.wg_brcjz}}" class="h50 p5 lookimg" />
								</div>
							</div>
						</div>
					</li>
				</ul>
			</div>
			<div class="um-footer">
				<a href="#page2" id="changepage2"></a>
				<button class="um-btn" onclick="page1_2()">
					填报验收信息
				</button>
			</div>
		</div>

		<div class="um-page" id="page2">
			<div class="um-header">
				<a href="#" class="um-back"> 返回 </a>
				<h3>维修验收填报</h3>
			</div>
			<div class="um-content">
				<ul class="um-list">
					<li class="um-list-item">
						<div class="um-list-item-inner">
							<div class="um-list-item-left pl5">
								<span class="um-red">*</span>验收照片
							</div>
							<div class="um-list-item-right">
								<img id="ys_yszp" ng-model="ys_yszp" onclick="openCamera(this,pageid)" ng-src="{{ys_yszp}}" class="h50 p5 camera" />
							</div>
						</div>
					</li>
					<li class="um-list-item">
						<div class="um-list-item-inner">
							<div class="um-list-item-left pl5">
								<span class="um-red">*</span>是否通过验收
							</div>
							<div class="um-list-item-right">
								<label class="um-switch2 um-box-vc ">
                                	<input type="checkbox" class="um-switch2" id="ys_sftgys" ng-model="ys_sftgys" ng-checked="ys_sftgys" />
                                    <span class="um-switch2-check" data-on-text="是" data-off-text="否"  style="margin-right: 0px; "></span>
								</label>
							</div>
						</div>
					</li>
					<li class="um-list-item wtg">
						<div class="um-list-item-inner">
							<div class="um-list-item-left pl5">
								<span class="um-red">*</span>维修未通过原因
							</div>
							<div class="um-list-item-right">
								<input type="text" ng-model="ys_wxwtgyy" class="form-control tr" placeholder="请填写" required>
							</div>
						</div>
					</li>
					<li class="um-list-item">
						<div class="um-list-item-inner">
							<div class="um-list-item-left pl5">
								<span class="um-red">*</span>工作类型
							</div>
							<div class="um-list-item-right">
								<select id="ys_gzlx" ng-model="ys_gzlx" class="select">
									<option ng-repeat="x in gongzuoleixing" value="{{x.pk_doc}}">{{x.doc_name}}</option>
								</select>
							</div>
						</div>
					</li>
				</ul>
			</div>
			<div class="um-footer">
				<button class="um-btn" onclick="page2_submit()">
					提交
				</button>
			</div>
		</div>
	</body>

</html>

<script>
	var angularScope; //anglajs
	var pageParam; //打开当前页的参数
	var changeObj; //根据单号加载的数据 修改
	var pageid = "repaircheckInstalled";

	summerready = function() {
		try { pageParam = summer.pageParam; } catch(e) {}
		//pageParam = { "bsbbh": "BAC006303", "bzcbh": "212121", "bdwh": "2017033001-1", "bsjjymc": "23", "bsjjydz": "123", "js_sfwy": "Y", "bpk": "1001ZZ100000000170NG" };
		gongzuoleixing();
		doPost(adressHead.IMaintenanceImpl, "getYsCard3", {
			dataParm: {
				bpk: pageParam.bpk
			}
		}, function(jsons) {
			jsons.data.wg_wgzp = (!!jsons.data.wg_wgzp) ? "data:image/jpeg;base64," + jsons.data.wg_wgzp : jsons.data.wg_wgzp;
			jsons.data.wg_ghjzp = (!!jsons.data.wg_ghjzp) ? "data:image/jpeg;base64," + jsons.data.wg_ghjzp : jsons.data.wg_ghjzp;
			jsons.data.wg_brcjz = (!!jsons.data.wg_brcjz) ? "data:image/jpeg;base64," + jsons.data.wg_brcjz : jsons.data.wg_brcjz;

			angularScope.data = jsons.data;
			angularScope.$apply();
		});
	}

	function gongzuoleixing() {
		doPost(adressHead.ISjtzImpl, "getBdDoc", {
			dataParm: {
				dostype: "app_worktype"
			}
		}, function(jsons) {
			angularScope.gongzuoleixing = jsons;
			angularScope.$apply();
		}, null, true);
	}
	$('.select').change(function() {
		$("#" + $(this).attr("id") + "_dummy").val($(this).find("option:selected").text());

		//无选择时，改为请选择
		var thiss = this;
		if(!$(this).find("option:selected").text()) {
			setTimeout(function() {
				$("#" + $(thiss).attr("id") + "_dummy").val("请选择");
			}, 110);
		}
	});
	$("input").change(function() {
		switch(this.id) {
			case "ys_sftgys":
				setTimeout(function() {
					if(angularScope.ys_sftgys) {
						$(".wtg").hide();
					} else {
						$(".wtg").show();
					}
				}, 100);
				break;
		}
	});

	var app = angular.module('myApp', []);
	app.controller('myCtrl', function($scope, $http) {
		angularScope = $scope;
	});

	//第一步确认按钮
	var json1;

	function page1_2() {
		$("#changepage2").click();
	}

	//第二部提交按钮 是否暂存
	function page2_submit() {
		if(!imgs["ys_yszp"]) {
			toasts("请拍摄验收照片");
			return;
		}
		if(!angularScope.ys_sftgys) {
			if(!angularScope.ys_wxwtgyy) {
				toasts("请填写未通过原因");
				return;
			}
		}
		if(!angularScope.ys_gzlx) {
			toasts("请选择工作类型");
			return;
		}
		UM.confirm({
			title: '友情提示:',
			text: '确认要提交到服务器吗？',
			btnText: ["取消", "提交"],
			overlay: true,
			ok: function() {
				page2_submit2();
			},
			cancle: function() {}
		});
	}

	function page2_submit2() {
		var userinfo = summer.getStorage("userinfo");
		doPost(
			adressHead.IMaintenanceImpl, "updateYsWxpg", {
				dataParm: {
					bpk: pageParam.bpk,
					ys_yszp: imgs["ys_yszp"] || "",
					ys_sftgys: angularScope.ys_sftgys ? "Y" : "N",
					ys_wxwtgyy: angularScope.ys_wxwtgyy || "",
					ys_gzlx: angularScope.ys_gzlx || ""
				}
			},
			function(jsons) {
				if(jsons.result == 1) {
					toasts("提交成功");
					summer.execScript({
						winId: 'repaircheckList2',
						script: "rebind()"
					});
					summer.closeWin();
				} else {
					toasts("提示：" + jsons.msg);
				}
			}
		)
	}

	//下拉框样式
	$(function() {
		var opt = {
			'date': {
				preset: 'date'
			},
			'select': {
				preset: 'select'
			}
		};
		$('.select').scroller('destroy').scroller($.extend(opt['select'], {
			theme: "ios7",
			mode: "scroller",
			display: "bottom",
			animate: ""
		}));
		$('.select').each(function(a, b) {
			$("#" + b.id + "_dummy").addClass("select_dummy");
			$("#" + b.id + "_dummy").val("请选择");
		});

		$("img.camera").attr("src", "../../img/myimg/camera.png");
	});
</script>

<script src="../../js/Myjs/Common.js"></script>